package com.cwz.api.factory;

import com.cwz.api.entity.SysLogininfor;
import com.cwz.api.entity.SysOperLog;
import com.cwz.api.remote.RemoteLogService;
import com.cwz.core.result.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @program: w-demo
 * @description: 日志服务降级处理
 * @author: Wen
 **/
@Component
@Slf4j
public class RemoteLogFallbackFactory implements FallbackFactory<RemoteLogService> {
	@Override
	public RemoteLogService create(Throwable cause) {
		log.error("日志服务调用失败:{}", cause.getMessage());
		return new RemoteLogService() {
			@Override
			public R<Boolean> saveLog(SysOperLog sysOperLog, String source) {
				return null;
			}

			@Override
			public R<Boolean> saveLogininfor(SysLogininfor sysLogininfor, String source) {
				return null;
			}
		};
	}
}
